package com.txc.common.utils.HttpUtils;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

import static com.txc.common.global.constant.StrConstant.*;

/**
 * @ClassName: HttpUtils
 * @Author: TXC
 * @Date: 2022-07-22 16:19
 **/
public class HttpUtils {
    /**
     * 获取请求URI
     * @return 获取请求URI
     */
    public static String getPermissionsCode() {
        ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        assert requestAttributes != null;
        HttpServletRequest request = requestAttributes.getRequest();
        return request.getHeader(PERMISSIONS_CODE);
    }
}
